<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <button onclick="array()">按钮</button>
  <script>
    function array() {
      var uaname = prompt('请输入账号：（必须为英文字母）')
      var password = prompt('请输入数字：（必须为数字）')
      if ((/[a-zA-z]+/).exec(uaname) && (/[0-9]+/).exec(password)) {
        alert('登录成功')
      } else {
        alert('失败')
      }
    }
  </script>
</body>

</html>